#include "driver/DRV8701E_RT1064.h"

void DRV8701E_RT1064::Init(uint8_t _channel)
{
    switch (_channel)
    {
    case PH:
        GPIO_PinWrite(Gpio_base,pin,0); 
        break;
    case EN:
        /* Set the load okay bit for all submodules to load registers from their buffer */
        //base->SM[module].DISMAP[0] = 0;
				PWM_SetPwmLdok(base, control_module, true);
        PWM_StartTimer(base, control_module);
        break;

    default:
        break;
    }
}
void DRV8701E_RT1064::SetDuty(uint8_t _channel, uint32_t _duty)
{
    // 判断是ph还是en
    switch (_channel)
    {
    case PH:
        /* code */
        GPIO_PinWrite(Gpio_base,pin,(_duty > 0 ? 1:0)); 
        break;
    case EN:
        /* code */
		PWM_SetPwmLdok(base, control_module, false);
        PWM_UpdatePwmDutycycleHighAccuracy(base,module,channel,kPWM_EdgeAligned,_duty);
        PWM_SetPwmLdok(base, control_module, true);
        break;

    default:
        break;
    }
}
